package com.cineplanet.dew.dao;

import javax.sql.DataSource;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.cineplanet.dew.exception.DAOExcepcion;
import com.cineplanet.dew.modelo.CarritoCompra;

public class CarritoCompraDAOImpl extends HibernateDaoSupport implements CarritoCompraDAO {

	private DataSource dataSource;

	public void setDataSource(DataSource dataSource) {
		this.dataSource = dataSource;
	}
	@Override
	public CarritoCompra insertar(CarritoCompra carritoCompra)
			throws DAOExcepcion {
		try {
			getHibernateTemplate().save(carritoCompra);
		    getHibernateTemplate().flush();
		} catch (Exception e) {

			throw new DAOExcepcion(e.getMessage());
		}
		return carritoCompra;
	}

}
